class CreateBallots < ActiveRecord::Migration
  def self.up
    create_table :ballots do |t|
      t.boolean :cast, :default => false
      t.integer :user_id, :null => false
      t.integer :election_id, :null => false, :on_delete => :cascade
    end
    add_index :ballots, [:user_id, :election_id], :unique => true
  end

  def self.down
    drop_table :ballots
  end
end
